package com.salary.web;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.common.util.ExtjsAjaxResponse;
import com.common.util.ExtjsPageable;
import com.salary.entity.BasicSalary;
import com.salary.entity.dto.BasicSalaryDTO;
import com.salary.service.IBasicSalaryService;
import com.staff.entity.dto.StaffQueryDTO;

@Controller
@RequestMapping("/basicSalary")
public class BasicSalaryController {
	@Autowired
	private IBasicSalaryService basicSalaryService;
	

	@RequestMapping("/findPage")
	public @ResponseBody Page<BasicSalaryDTO> findPage(StaffQueryDTO dto,ExtjsPageable pageable){
		try {
			return basicSalaryService.findPage(StaffQueryDTO.getSpecification(dto), pageable.getPageable());
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	@RequestMapping("/saveOrUpdate")
	public @ResponseBody ExtjsAjaxResponse saveOrUpdate(BasicSalaryDTO dto) {
		try {
			basicSalaryService.saveOrUpdate(dto);
			return new ExtjsAjaxResponse(true,"操作成功！");
		} catch (Exception e) {
			e.printStackTrace();
			return new ExtjsAjaxResponse(false,"操作失败！");
		}
		
	}
}
